package com.example.mapper;


import com.example.pojo.Source;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;

@Mapper
public interface UploadMapper {

    /*
     * 将GDB解析数据存入表中，如果layer相同，则更新信息
     * */
    @Insert("insert into source_data(coordinate_system, field, layer, element_count, datatype," +
            "createtime, bounds, owner, sourcename) VALUES (#{coordinatesystem}, #{field}, #{layer}, #{elementcount}," +
            "#{datatype}, #{createTime}, #{bounds}, #{owner}, #{sourcename})ON CONFLICT (layer) DO UPDATE " +
            "SET coordinate_system = EXCLUDED.coordinate_system,field = EXCLUDED.field,element_count = EXCLUDED.element_count," +
            "datatype = EXCLUDED.datatype,createtime = EXCLUDED.createtime,bounds = EXCLUDED.bounds,OWNER = EXCLUDED.OWNER,sourcename = EXCLUDED.sourcename;")
    void insert(Source source);
}
